<%-- 
    Document   : deleteComment
    Created on : Dec 9, 2011, 5:38:33 AM
    Author     : Owner
--%>

<%@page import="java.sql.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<% if(session.getAttribute("LoggedIn")==null)
       {
    response.sendRedirect("index.html");
    return;
        }

%>
<%
    String circleID = request.getParameter("CIRC");
    String commentID = request.getParameter("CMT");
    
    session.setAttribute("CIRC",circleID);
    
    Connection conn = null;
    try
    {
        conn = new DBClasses.GetConnection().getConnection();
        String sql ="DELETE FROM Comments WHERE CommentID = "+commentID;
        conn.createStatement().execute(sql);
    }
    catch(Exception e)
    {
        e.printStackTrace();
        response.sendRedirect("CirclePage.jsp");
    }
    finally
    {
        try
        {
            conn.commit();
            conn.close();
            
            response.sendRedirect("CirclePage.jsp"); 
        }
        catch(Exception e)
        {
            e.printStackTrace();
            response.sendRedirect("CirclePage.jsp"); 
        }
    }
%>